<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>kavadenn: explorer la bretagne</title>

</head>
<body>

    <h1>Testing Flickr</h1>
    <div id="output">
      
    </div>

    <script src="/static/js/jquery/jquery.js" type="text/javascript"></script>
        
    <script type="text/javascript">
        /* <![CDATA[ */
        
        function handleImagesLoaded(d){
          
          $("#output").html("");
          
          for(var i=0; i<d.photos.photo.length; i++){
             p = d.photos.photo[i];
             url = 'http://farm' + p.farm + '.static.flickr.com/' + p.server + '/' + p.id + '_' + p.secret + '_s.jpg';
          
             $("#output").append("<img src='"+ url +"' />");
          }
          
        }
        
        function search4Images(perPage,page,searchTerm){
          //$.getJSON('http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=d8a3dc9dcdfa515c5ae6d99897578604&per_page='+ perPage + '&page='+ page + '&text=' + escape(searchTerm) + "&format=json&jsoncallback=?",
          //    handleImagesLoaded
          //);
          var lon = -4.73;
          var lat = 48.43;
          
          $.getJSON('http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=d8a3dc9dcdfa515c5ae6d99897578604&per_page='+ perPage + '&page='+ page + '&lon=' + lon + '&lat=' + lat + "&radius=20&format=json&jsoncallback=?",
              handleImagesLoaded
          );
        }
        
        
        
        $(document).ready(function() {
            search4Images(10,1,"puppy");
        });
        /* ]]> */
    </script>

</body>
</html>
